import request from '@/utils/request'
import axios from 'axios'

// 业主管理API接口
export const homeownerApi = {
  // 分页查询业主列表
  getHomeownerPage(params) {
    return request({
      url: '/homeowner/pageall',
      method: 'post',
      data: params
    })
  },

  // 根据ID查询业主详情
  getHomeownerById(homeId) {
    return request({
      url: '/homeowner/homeowner',
      method: 'get',
      params: { homeId }
    })
  },

  // 新增业主
  addHomeowner(data) {
    return request({
      url: '/homeowner/addhomeowner',
      method: 'post',
      data
    })
  },

  // 修改业主信息
  updateHomeowner(data) {
    return request({
      url: '/homeowner/updahomeer',
      method: 'post',
      data
    })
  },

  // 迁入
  moveIn(homeId) {
    return request({
      url: '/homeowner/inhome',
      method: 'put',
      params: { homeId }
    })
  },

  // 迁出
  moveOut(homeId) {
    return request({
      url: '/homeowner/outhome',
      method: 'put',
      params: { homeId }
    })
  },

  // 初始化测试数据
  initTestData() {
    return request({
      url: '/homeowner/initTestData',
      method: 'post'
    })
  }
}
